const question = require('../models/question');

var express = require('express');
var router = express.Router()

var formidable = require('formidable')

router.post('/', (req, res, next) => {
    var form = new formidable.IncomingForm();
    form.parse(req, function (err, fields, files) {
        if(err) {
            res.json({'state': false, 'msg': 'There is somethin wrong!'});
        }else {
            question.find({
                _id: fields.question_id
            }, (err, docs) => {
                if(err) {
                    res.json({'state': false, 'msg': '查询提高题出错！'});
                }else {
                    res.json({
                        'state': true,
                        'question' : docs[0]
                    })
                }
            })
        }
    });
});

module.exports = router;